<?php

// +----------------------------------------------------------------------
// | 用户操作
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://www.cencn.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 彦子谷  <56583965@qq.com> <http://www.xzqly.com>
// +----------------------------------------------------------------------

namespace Lapi\Controller;
use Think\Controller;  //测试可以用于替换成Controller－－－删除
use Think\Controller\RpcController;
use Lapi\Api\UserApi;

class UserController extends RpcController {

    //允许执行 mac 地址
    protected $allowMacList = array("", "");
    //允许远程执行方法
    protected $allowMethodList = array('login', 'getUserInfo', "saveMemberData","addMemberData" ,'getUserArray','recommendCount');
    /**
     * 用户登陆
     * @param type $username 用户名
     * @param type $password 密码
     * @param type $type  登陆类型
     * @return int  用户ID
     */
    public function login($username, $password, $type = 1) {
        $User = new UserApi;
        return $User->login($username, $password, $type);
    }

    /**
     * 获取用户信息
     * @param type $uid 用户Id
     * @return json 用户信息
     */
    public function getUserInfo($uid=1,$is_username = false) {
        $MembersApi = new \Lapi\Api\MembersApi;
        return $MembersApi->info($uid,$is_username);
    }
    /**
     * 更新Member数据
     */
    public function saveMemberData($data){
        $MembersApi = new \Lapi\Api\MembersApi;
        return $MembersApi->saveData($data);
    }
    /**
     * 保存Member数据
     */
    public function addMemberData($data){
     
        $MembersApi = new \Lapi\Api\MembersApi;
        return $MembersApi->addData($data);
    }

   
}
